﻿using System;
using Sinacor.Infra.Core.ProcessManager.Server;
using PSE.ProcessManager.Server.InteligenceModules;
using PSE.ProcessManager.Common.Gateway;
using Sinacor.Infra.Common.Exceptions;
using Sinacor.Infra.Service.ExceptionHandling;

namespace Sinacor.Process.Bovespa.Casamento.Server.ProcessImplementation
{
    public class CasamentoAutomatico: SinacorBaseProcessServer<ProcessLogic.CasamentoAutomatico>, ISimpleExecutionProcess 
    {       
       #region Construtor
        /// <summary>
        /// CasamentoAutomatico
        /// </summary>
        public CasamentoAutomatico() {}
       #endregion

       #region Execute
         /// Execute
         /// <param name="message">BaseMessage</param>
         public void Execute(BaseMessage message)
         {
             try
             {
                 //while (!System.Diagnostics.Debugger.IsAttached)
                 //    System.Threading.Thread.Sleep(1000);

                 ProcessEntity.DadosCasamentoAut _dadosCasamentoAut = message.RetrieveParameter<ProcessEntity.DadosCasamentoAut>();
                 this.ProcessLogic.Execute(_dadosCasamentoAut);
             }
             catch (Exception ex)
             {   
                 this.HandleException(ex);                 
             }
             finally
             {
                 this.Finalize();
             }
         }
         #endregion Execute
    }
}
